using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using SIGCBI.Entities;

namespace SIGCBI.Repository.Mapping
{
    public class PROVEEDORMap : EntityTypeConfiguration<PROVEEDOR>
    {
        public PROVEEDORMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            this.Property(p => p.ID).
                HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            // Properties
            this.Property(t => t.Ruc)
                .IsRequired()
                .HasMaxLength(11);

            this.Property(t => t.RazonSocial)
                .IsRequired()
                .HasMaxLength(200);

            this.Property(t => t.Direccion)
                .HasMaxLength(200);

            this.Property(t => t.Telefono)
                .HasMaxLength(21);

            // Table & Column Mappings
            this.ToTable("PROVEEDOR");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.Ruc).HasColumnName("Ruc");
            this.Property(t => t.RazonSocial).HasColumnName("RazonSocial");
            this.Property(t => t.Direccion).HasColumnName("Direccion");
            this.Property(t => t.Telefono).HasColumnName("Telefono");
        }
    }
}
